
from WtfEngine import *;
import WtfGui;

gFont = WtfGui.Font("v_gui_font");

class TitleMenu(WtfGui.WindowManager):
	def __init__(self, items, order, font = gFont):
		WtfGui.WindowManager.__init__(self);
		
		menu = WtfGui.Menu("Title Menu");
		menu.Resize(300, 100);
		
		for n in order:
			menu.AddChild(WtfGui.Button(Function(items[n]), n, font));
		
		self.AddChild(WtfGui.LayoutPositioner(menu, WtfGui.CentrePositioner(), WtfGui.CentrePositioner()));

class GameMenu(TitleMenu):
	def __init__(self, items, order, font = gFont, key = InputKey(27,0)):
		items['Resume Game'] = (lambda: self.WmToggle());
		items['Exit'] = (lambda: Kernel.GetInst().PopGameState());
		order = ['Resume Game'] + order;
		
		TitleMenu.__init__(self, items, order, font);
		self.BindToEvent(KeyDownEvent(key));

